package com.gitee.minimalismstyle.fresh.common.data.beetl.service.impl

import com.gitee.minimalismstyle.fresh.common.core.domain.R
import com.gitee.minimalismstyle.fresh.common.data.beetl.dao.BaseDao
import com.gitee.minimalismstyle.fresh.common.data.beetl.model.Model
import com.gitee.minimalismstyle.fresh.common.data.commons.service.BaseService

abstract class ModelBaseServiceImpl<DAO : BaseDao<T, ID>, T : Model<ID>, ID>
    : BaseService<T, ID>,  BaseServiceImpl<DAO, T, ID>(){
    override fun findById(id: ID): R<T> {
        val t = dao.findById(id)
        return if (t.delFlag == 0){
            R.error("数据不存在或者已被删除！")
        }else{
            R.success(t)
        }
    }
}